#include "swpsimswimlanegraphicitem.h"

#include "graphicitemcommon.h"

using namespace core;
using namespace swp;

SwpSimSwimlaneGraphicItem::SwpSimSwimlaneGraphicItem(QGraphicsItem* parent) :
    SwpSwimlaneGraphicItem(QString(), parent), ISimItem(),
    m_isInSimPath(false),
    m_originId()
{
    setFlag(QGraphicsItem::ItemIsMovable, false);
}

SwpSimSwimlaneGraphicItem::SwpSimSwimlaneGraphicItem(
    SwpSwimlaneGraphicItem* from,
    QGraphicsItem* parent) : SwpSwimlaneGraphicItem(
        from->propertyValue("name").toString(), parent), ISimItem(),
        m_isInSimPath(false),
        m_originId(from->id())
{
    setFlag(QGraphicsItem::ItemIsMovable, false);

    setPos(from->pos());

    setPolygonF(from->polygon());
}

SwpSimSwimlaneGraphicItem::~SwpSimSwimlaneGraphicItem()
{

}

bool SwpSimSwimlaneGraphicItem::supportsConnection(
        const ConnectionData& connection) const
{
    return connection.ConnectionId == CONNECTION_SIM_PATH;
}

int SwpSimSwimlaneGraphicItem::type() const
{
    return SWP_SIM_SWIMLANE_ITEM;
}

IEditorItem* SwpSimSwimlaneGraphicItem::copy() const
{
    return new SwpSimSwimlaneGraphicItem();
}

bool SwpSimSwimlaneGraphicItem::isInSimPath() const
{
    return m_isInSimPath;
}

void SwpSimSwimlaneGraphicItem::setInSimPath(bool in)
{
    if (in)
    {
        setPen(QPen(m_palette->acceptsConnectionColor(), 2));
    }
    else
    {
        setPen(QPen(m_palette->borderColor(), 1));
    }

    m_isInSimPath = in;
}

QUuid SwpSimSwimlaneGraphicItem::originId() const
{
    return m_originId;
}

QList<Property> SwpSimSwimlaneGraphicItem::properties() const
{
    QList<Property> ret;

    return ret;
}

QVariant SwpSimSwimlaneGraphicItem::propertyValue(
    const QString& propertyName) const
{
    QVariant ret;

    return ret;
}

void SwpSimSwimlaneGraphicItem::propertyChanged(const QString& property,
    const QVariant& newValue, bool silent)
{

}

QVariantList SwpSimSwimlaneGraphicItem::optionList(
    const QString& propertyName) const
{
    QVariantList ret;

    return ret;
}

QVariantList SwpSimSwimlaneGraphicItem::autocomplete(
    const QString& propertyName) const
{
    QVariantList ret;

    return ret;
}

void SwpSimSwimlaneGraphicItem::hoverEnterEvent(
    QGraphicsSceneHoverEvent *event)
{

}

void SwpSimSwimlaneGraphicItem::hoverLeaveEvent(
    QGraphicsSceneHoverEvent *event)
{

}
